package com.stqf.scala.grammar.oop

import scala.beans.BeanProperty

/**
  * Created by ASUS on 2018-01-30.
  */
sealed class People(sid: Int, sname: String, sage: Int) {
  @BeanProperty var id: Int = sid
  var name: String = sname
  private var age: Int = sage

  def eat(str: String) = {
    println(str + " like eat")
  }

}

class Woman(sid: Int, sname: String, sage: Int) extends People(sid, sname, sage) {

}


object Main {
  def main(args: Array[String]): Unit = {
    var p = new People(1, "John", 35)
    var m = new Man(2, "姚明", 21)
    p.eat("John")
    val id = p.id
    println(id)

  }
}